//
// Created by buk on 8/29/24.
//

#ifndef AI_SERVICE_H
#define AI_SERVICE_H

#include <iostream>
#include <string>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <typeinfo>
#include <opencv2/opencv.hpp>

#include "../../inc/arcsoft_face_sdk.h"
#include "../../inc/amcomdef.h"
#include "../../inc/asvloffscreen.h"
#include "../../inc/merror.h"

#include "../data/data_store.h"
#include "../base/messages.hpp"

#include "threadsafe_queue.h"
#include "ai_engine_pool.h"
#include "device_thread_manager.h"
#include "device_functor.h"

namespace ai::facial_recognition {

    class AIService {
    public:
        AIService();
        ~AIService();

        void start();
        void stop();

        // 检测人脸
        void detect_faces();
        // 认脸特征提取
        void extract_face_feature();

        void test(DataStore data_store);
        void set_data_store(DataStore * data_store);

        void onWebRequest(RequestMessagePtr msg);

        void connect_rtsp();
        void disconnect_rtsp();

      // 数据存储访问句柄
      DataStore * _data_store = NULL;

      bool rtsp_connected = false;

        threadsafe_queue<cv::Mat> queue {10};

        // 虹软引擎池
        AIEnginePool engine_pool {0};

        DeviceThreadManager device_thread_manager {};


};

}

#endif //AI_SERVICE_H
